package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.pojo.Menu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ${xinpl}
 * @date 2020/4/15-20:20
 */
public interface MenuDao {

    int deleteByPrimaryKey(Integer id)throws Exception;

    int insertSelective(Menu record)throws Exception;

    Menu selectByPrimaryKey(Integer id)throws Exception;

    int updateByPrimaryKeySelective(Menu record)throws Exception;

    Page<Menu> selectByCondition(String queryString) throws Exception;

    int findCountByPermissionIdAndRole(int id);

    int findCountByPermissionId(int id);

    //返回所有数据,用于新增role展示
    List<Menu> findAll();

    //返回所有父级菜单
    @Select("select * from t_menu where level = 1")
    List<Menu> findParents();

    //通过父级菜单名 获取对应id
    @Select("select id from t_menu where name = #{value}")
    int getMenuIdByparentName(String parentName);

    @Select("select * from t_menu")
    List<Menu> findAllMenu();
}
